/*
 * Copyright © 2015 Cask Data, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */

@import '../../styles/variables.less';
@import '../../../bower_components/bootstrap/less/mixins.less';
@import '../../styles/themes/cdap/mixins.less';
@height-of-toppanel: 43px;

body.theme-cdap {
  &.state-hydratorplusplus {
    div.side-panel.top {
      background-color: white;
      border-bottom: 1px solid @table-border-color;
      position: fixed;
      top: 50px;
      right: 0;
      z-index: 1029;
      border-left: 0;
      border-top: 0;

      div.pipeline-type {
        color: #397cf1;
        float: left;
        text-decoration: none;
        span {
          display: inline-block;
          line-height: 35px;
          font-size: 1.8em;
          @media (min-width: @screen-sm-min) {
            font-size: 23px;
          }
        }
      }

      div.action-buttons {
        width: 100%;
      }
      div.btn {
        .cask-btn(@border: 0, @border-radius: 0, @color: #666, @padding: 0);
        border-right: 1px solid transparent;
        border-bottom: 1px solid transparent;
        border-left: 1px solid @table-border-color;
        height: @height-of-toppanel;
        padding: 0;
        .transition(all 0.2s ease);
        span {
          line-height: @height-of-toppanel;
        }
        &:hover, &:focus {
          background-color: #ebebeb;
          border-right: 1px solid #ebebeb;
          border-left: 1px solid @table-border-color;
        }
        &:active {
          background-color: #828da0;
          border-right: #828da0;
          border-bottom: 1px solid #828da0;
          color: white;
          .box-shadow(inset 0 0 20px 0 rgba(0, 0, 0, 0.25));
        }
        + .btn {
          margin-left: 0;
        }
        @media (max-width: @screen-xs-max) {
          display: none;
        }
      }
      .nopadding {
        padding: 0;
      }
      .nomargin {
        margin: 0;
      }
    }
    .toppanel-tooltip {
      &.in {
        .opacity(1);
      }
      &.top {
        .tooltip-arrow {
          border-top: 5px solid #666;
        }
      }
      &.right {
        width: 100%;
        .tooltip-arrow {
          border-right: 5px solid #666;
        }
      }
      &.bottom {
        .tooltip-arrow {
          border-bottom: 5px solid #666;
        }
      }
      &.icon-tooltip {
        width: auto;
      }
      .tooltip-inner {
        background-color: #666;
        border: 1px solid #666;
        padding-right: 10px;
        padding-left: 10px;
      }
    }
  }
  &.state-hydratorplusplus-create {
    div.side-panel.top {
      height: @height-of-toppanel;
      max-width: ~"-moz-calc(100% - 130px)";
      max-width: ~"-webkit-calc(100% - 130px)";
      max-width: ~"calc(100% - 130px)";
      left: 130px;
      .transition(all 0.2s ease);

      div.btn {
        width: 25%;
      }
      div.hydrator-metadata {
        background-color: transparent;
        position: relative;
        z-index: 1021;
        .box-shadow(none);
        .transition(all 0.2s ease);
        @media (min-width: @screen-lg-min) {
          max-width: 650px;
        }
        &:hover, &:focus {
          cursor: pointer;
        }
        div.pipeline-type {
          padding-left: 10px;
        }
        div.pipeline-name {
          margin-left: 10px;
          min-width: 135px;
          max-width: 85%;
          position: relative;
          &:after {
            position: absolute;
            font-family: FontAwesome;
            top: 5px;
            right: -30px;
            content: "\f040";
            .opacity(0);
            .transition(opacity 0.2s ease);
          }
          &:hover, &:focus {
            &:after {
              .opacity(1);
            }
          }
          > div {
            &:before {
              content: none;
              color: gray;
            }
            &:first-child, &:last-child {
              max-width: 100%;
              text-overflow: ellipsis;
              white-space: nowrap;
              overflow: hidden;
            }
            &:first-child {
              font-size: 14px;
              margin-top: 5px;
              line-height: 17px;
              &.placeholder {
                &:before {
                  content: "Name your pipeline";
                }
              }
            }
            &:last-child {
              font-size: 12px;
              &.placeholder {
                &:before {
                  content: "Enter a description for your pipeline";
                }
              }
            }
          }
        }
        input, textarea {
          background-color: transparent;
          display: inline-block;
          font-size: 12px;
          padding: 0;
          border: 1px solid @table-border-color;
          padding: 10px 12px;
          width: 100%;
          max-width: 100%;
          .border-radius(6px);
          .placeholder-color(@color: gray);
          &:hover, &:focus {
            cursor: auto;
          }
          &:focus {
            outline: 0;
          }
        }
        input {
          height: @height-of-toppanel;
        }
        textarea {
          font-weight: 400;
          resize: none;
          margin-bottom: 0;
          margin-top: 10px;
          min-height: 65px;
        }
        button {
          font-weight: 500;
          text-decoration: none;
          &.btn {
            width: 0;
            height: 0;
            .opacity(0);
            visibility: hidden;
            .transition(all 0.5s ease);
          }
        }
        &.expanded {
          background-color: white;
          height: 185px;
          cursor: auto;
          @box-shadow: 0 7px 7px fade(black, 10%), 0 19px 59px fade(black, 20%);
          .box-shadow(@box-shadow);
          div.pipeline-type {
            span {
              line-height: @height-of-toppanel;
            }
          }
          div.pipeline-name {
            width: 85%;
            padding-top: 10px;

            &:after {
              content: none;
            }
          }
          div.btn-group {
            margin: 10px 0;
            padding-right: 10px;
            .btn {
              display: inline-block;
              width: auto;
              height: 32px;
              padding: 0 10px;
              .border-radius(4px);
              .opacity(1);
              .transition(all 0.2s ease);
              visibility: visible;
              &:first-child {
                background-color: @body-bg;
                &:hover, &:focus {
                  background-color: darken(@body-bg, 10%)
                }
              }
              &:last-child {
                margin-left: 5px;
              }
            }
          }
        }
      }
    }
  }
  &.state-hydratorplusplus-detail {
    div.side-panel.top {
      left: 0;
      max-width: 100vw;
      height: 70px;

      div.tbl {
        display: table;
        height: @height-of-toppanel;
        width: 100%;
      }
      div.tbl-cell {
        display: table-cell;
        border-left: 1px solid @table-border-color;
        padding: 0 10px;
        vertical-align: middle;
        text-align: left;
        &:first-child, &:last-child {
          border-left: 0;
        }
        &:last-child {
          padding-right: 0;
        }
      }
      div.batch div.tbl-cell {
        &:first-child {
          width: 24%;
        }
        &:nth-child(2) {
          width: 6%;
        }
        &:nth-child(3) {
          width: 20%;
        }
        &:nth-child(4) {
          width: 15%;
        }
        &:nth-child(5) {
          width: 14%;
        }
        &:last-child {
          width: 21%;
        }
      }
      div.realtime div.tbl-cell {
        &:first-child {
          width: 24%;
        }
        &:nth-child(2) {
          width: 6%;
        }
        &:nth-child(3) {
          width: 27%;
        }
        &:nth-child(4) {
          width: 22%;
        }
        &:last-child {
          width: 21%;
        }
      }
      .hydrator-detail-metadata {
        div.pipeline-type {
          text-decoration: none;
          padding: 0 10px 0 5px;
          span {
          }
        }
        div.pipeline-name {
          text-align: left;
          padding-top: 4px;
        }
        h1, p {
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          max-width: 100%;
        }
        h1 {
          font-size: 16px;
          font-weight: 500;
          margin-top: 0;
          margin-bottom: 0;
          line-height: 20px;
        }
        p {
          color: #666;
          font-size: 12px;
          font-weight: 400;
          margin: 0;
        }
      }
      div.app-status {
        .metric-value {
          font-size: 20px;
          line-height: 20px;
          padding-bottom: 2px;
        }
        &.status-green span {
          color: @brand-success;
        }
        &.status-red span {
          color: @brand-danger;
        }
        span {
          line-height: inherit;
        }
      }
      div.last-run {
        div.metric {
          &:first-child {
            padding-right: 5px;
            width: 62%;
          }
          &:last-child {
            width: 38%;
          }
        }
      }
      div.all-runs {
        div.metric {
          &:first-child {
            padding-right: 5px;
            width: 60%;
          }
          &:last-child {
            width: 40%;
          }
        }
      }
      strong {
        display: block;
        font-size: 12px;
        margin-bottom: 2px;
      }
      span {
        display: block;
      }
      span.metric-value {
        color: #636363;
        font-size: 13px;
        font-weight: 500;
        line-height: 1;
        small {
          font-size: 10px;
          font-weight: 400;
        }
      }
      span.metric-label {
        font-size: 10px;
        color: rgba(0, 0, 0, 0.4);
        font-weight: 600;
      }
      div.action-buttons {
        &.batch > div {
          width: 20%;
        }
        &.realtime > div {
          width: 25%;
        }
        div.btn {
          width: 100%;
          height: 70px;
          span {
            line-height: 70px;
          }
        }
      }
    }
  }
  &.state-hydratorplusplus-list {
    div.side-panel.top {
      font-weight: 500;
      left: 0;
      z-index: 1028;
      height: 60px;
      max-width: 100vw;
      .box-shadow(0 7px 7px fade(black, 10%), 0 10px 59px fade(black, 25%););
      h1 {
        border-right: 1px solid @table-border-color;
        display: inline-block;
        font-size: 20px;
        line-height: 60px;
        margin: 0;
        padding: 0 15px;
      }
      > div {
        padding: 7px 15px;
        span {
          display: block;
          &:first-child {
            font-size: 15px;
          }
          &:last-child {
            font-size: 18px;
          }
        }
      }
      ul {
        line-height: 60px;
        margin: 0;
        li {
          padding: 0 15px;
          i {
            font-size: 22px;
            margin-right: 10px;
            vertical-align: sub;
          }
          span {
            font-size: 15px;
            &:first-child {
              padding-right: 5px;
            }
          }
        }
      }
      a.btn-primary {
        position: absolute;
        right: 40px;
        top: 35px;
        padding: 12px 16px;
        .border-radius(50%);
        span.fa {
          font-size: 24px;
          vertical-align: middle;
        }
      }
    }
  }
}
